package licode.unisop.provider.utils;

/**
 * 字符串工具类
 *
 * @author licode
 * @version 1.0
 * @date 2015-05-01 16:09
 */
public class StrUtil {
    public static boolean isBlank(String str) {
        int length;
        if (str != null && (length = str.length()) != 0) {
            for(int i = 0; i < length; ++i) {
                if (!StrUtil.isBlankChar(str.charAt(i))) {
                    return false;
                }
            }

        }
        return true;
    }

    public static boolean isNotBlank(String str) {
        return !isBlank(str);
    }

    public static boolean isBlankChar(char c) {
        return isBlankChar((int)c);
    }

    public static boolean isBlankChar(int c) {
        return Character.isWhitespace(c) || Character.isSpaceChar(c) ||
                c == 65279 || c == 8234 || c == 0 ||
                c == 12644 || c == 10240 || c == 6158;
    }
}
